#pragma once
#include <Rz/Object.h>
#include <Rz/Memory.h>
#include <Rz/IHumanReadable.h>

namespace Rz { namespace Graphics { namespace Math {

// TODO: IComparable?
class Matrix3 :
	public Object,
	public IHumanReadable
{
	public:
		RZ_RTTI(Rz::Graphics, Matrix3);
		RZ_RTTI_IMPLEMENTS(Object, IHumanReadable);
		RZ_RTTI_END;

		union
		{
			struct
			{
				f32 M11, M21, M31;
				f32 M12, M22, M32;
				f32 M13, M23, M33;
			};

			struct
			{
				f32 Cell[9];
			};
		};

		Matrix3();

		Matrix3(const Matrix3& m);

		Matrix3(f32 m11, f32 m12, f32 m13,
				f32 m21, f32 m22, f32 m23,
				f32 m31, f32 m32, f32 m33);

		Matrix3& operator = (const Matrix3& m);

		f32 GetCell(u32 index);
		f32 GetCell(u32 x, u32 y);

		void SetCell(u32 index, f32 value);
		void SetCell(u32 x, u32 y, f32 value);

		virtual String ToString() const override;

		static const Matrix3 Zero;
		static const Matrix3 One;
		static const Matrix3 Identity;
};

} } }
